import Storage from '@/store/MyStorage';

export default {
  namespaced: true,
  state: () => ({
    userInfo: {}
  }),
  getters: {
    userInfo(state) {
      return state.userInfo;
    }
  },
  mutations: {
    setUserInfo(state, userInfo) {
      state.userInfo = userInfo;
      Storage.setObject('userInfo', userInfo);
    }
  },
  actions: {
    setUserInfo({commit}, userInfo) {
      commit('setUserInfo', userInfo);
    },
    loadStorage({commit}) {

      commit('setUserInfo', Storage.getObject('userInfo'));
    },
  }
};
